/**
 * 
 */
package com.zhanggz.mypattern.strategy;

/**
 * 策略模式，鸭子抽象类
 * 
 * @author Alex
 * @date 2015年6月24日
 */
public abstract class Duck {

	/**
	 * 鸭子发出叫声，通用行为，由超类实现
	 */
	public void quake() {
		System.out.println("嘎嘎嘎");
	}

	/**
	 * 显示鸭子外观，由子类实现
	 */
	public abstract void display();

	private FlyingStrategy flyingStrategy;

	/**
	 * @param flyingStrategy
	 *            the flyingStrategy to set
	 */
	public void setFlyingStrategy(FlyingStrategy flyingStrategy) {
		this.flyingStrategy = flyingStrategy;
	}

	public void fly() {
		flyingStrategy.performFly();
	}
}
